#ifndef FFMPEGDECODER_HPP
#define FFMPEGDECODER_HPP

#ifndef INT64_C
#define INT64_C(c) (c ## LL)
#define UINT64_C(c) (c ## ULL)
#endif

#include "Decoder.hpp"
extern "C" {
#include <libavcodec/avcodec.h>
#include <libavformat/avformat.h>
#include <libavutil/avutil.h>
}

/// @brief Decoder class for FFmpeg supported audio formats
class FFmpegDecoder : public Decoder {
    private:
        AVCodec *codec;
        AVFormatContext *formatContext;
        AVFrame *pFrame;
        AVPacket packet;
    public:
    bool load(const char* filename, bool silence=false);
    void close();
    int decode(float *data, unsigned long frames);
    bool seek(unsigned int frame);
    FFmpegDecoder();
    ~FFmpegDecoder();
};

#endif // FFMPEGDECODER_HPP
